<template>
    <div><span>{{myData}}</span>
    <h3>{{myData.code}}</h3>
    <h4>{{info.rate_float}}</h4>
    </div>
</template>
<script>
import axios from 'axios'

export default {
  name: "axios",
  props: {
    msg: String
  },
  data () {
    return {
      info:  {
   
          rate_float:0.0
      },
      loading: true,
      errored: false,
      myData: {
          code:'',
          symbol:'',
          rate:0.0,
          description:'',
          rate_float:0.0
      }
    }
  },
  mounted (){
      axios
      .get('https://api.coindesk.com/v1/bpi/currentprice.json')
      .then(response => {
        this.info = response.data.bpi.EUR
        this.myData=response.data.bpi.EUR
        // console.log(this.myData)
      })
      .catch(error => {
        console.log(error)
        this.errored = true
      })
      .finally(() => this.loading = false)
  }
}
</script>